package com.yequan.string;


import com.yequan.work.JsonMapper;
import com.yequan.work.StringUtil;
import org.apache.commons.lang3.StringUtils;

import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author yq
 * @date 2020/08/20
 */
public class StringFormat {

    public static void main(String[] args) {
//        extracted();
//        eq();
        num();
    }

    public static void num(){
        String num = "8.10.46.minipg_taxiqr_wx";
        System.out.println(judgeContainsStr(num));
//        System.out.println(isNumber(num));
    }

    public static boolean judgeContainsStr(String cardNum) {
        String regex=".*[a-zA-Z]+.*";
        Matcher m= Pattern.compile(regex).matcher(cardNum);
        return m.matches();
    }

    public static boolean isNumber(String str){

        String reg = "^[0-9]+(.[0-9]+)+(.[0-9]+)?$";

        return str.matches(reg);

    }

    public static void eq(){
        System.out.println(StringUtils.equals("aa", "aa"));
    }

    private static void extracted() {
        StringBuffer buffer = new StringBuffer();
        for (int i = 0; i < 10; i++) {
            buffer.append(String.format("%02d@%02d", 5, (i + 1))).append(", ");
        }
        System.out.println(buffer.toString());

        String a= "hello";
        String[] split = a.split(",");
        System.out.println(JsonMapper.toJson(split));

        String v ="vivo vivo X21UD A";
        System.out.println(v.contains("VIVO"));

        String stat="{\"SUM_WITHDRAW\":\"0\",\"REPLY_BOOKING_NUM\":\"0\",\"BOOKING_SERVE_NUM\":\"0\",\"SUM_INCOME_AS_DRIVER\":\"0\",\"AVG_SCORE_AS_DRIVER\":\"0\",\"BOOKING_PAY_NUM\":\"1\",\"BOOKING_SUM_METER\":\"66073\",\"AVG_SCORE_AS_PASSENGER\":\"0\",\"DRIVER_SUM_METERS\":\"0\",\"BOOKING_NUM\":\"1\",\"BEEN_REVIEWED_NUM_AS_DRIVER\":\"0\",\"BEEN_REVIEWED_NUM_AS_PASSENGER\":\"0\"}";
        Map<String, Object> userStatMap = JsonMapper.json2Map(stat);
        Object onRideNumObj = null;
        if (userStatMap.containsKey("BOOKING_PAY_NUM") && null != (onRideNumObj = userStatMap.get("BOOKING_PAY_NUM"))) {
            int onRideNum = Integer.parseInt((String) onRideNumObj);
            if (onRideNum > 0) {
                System.out.println("hhhhhhhh");
            }
        }
    }

}
